// To change this License template, choose Tools / Templates
// and edit Licenses / FanDefaultLicense.txt
//
// History:
//   22.01.2011 jst Creation
//

**
** Database
**
class Database
{
  const Str name
  
  Str:Table tables := [:]
    
  new make(Str name, |This|? closure:=null) {
    this.name = name
    if (closure!=null) closure(this)
  }
  
  @Operator
  This add(Table table) {
    table.database = this
    tables[table.name] = table
  }
  
  Table table(Str name) {
    Table tbl := Table(name)
    add(tbl)
    return tbl
  }
  
  Table get(Str name) {
    tables.get(name)
  }
  
  
}